var express = require('express');
var router = express.Router();
var userService = require("../services/userService");
var checkUserLogin = require("../middlewares/checkUserLogin");

/* GET users listing. */

/* router.get('/', function(req, res) {
    res.send('respond with a resource');
}); */

//注册
router.post('/register', userService.register);

//用户中心-页面
router.get('/userCenter/:_id',checkUserLogin,userService.goUserCenter);

//安全中心-页面
router.get('/security/:_id',checkUserLogin,userService.goSecurity);

//提示用户检查邮箱激活账户-页面
router.get('/tipEmail',userService.tipEmail);

//获取用户列表-页面
router.get('/userList', checkUserLogin,userService.getUserList);

//删除用户
router.post('/deleteUser', userService.deleteUser);

//登陆验证
router.post('/login', userService.login);

//用户登出(注销)
router.get('/logout',userService.logout);

//获取用户信息
router.get('/getUserInfo', userService.getUserInfo);

//更新用户信息(不刷新页面)
router.post('/updateUser',userService.updateUserWithoutRefresh);

//更新用户信息(刷新页面)
router.post('/updateInfo',userService.updateUserAndRefresh);

//验证用户名
router.post('/verifyUsername',userService.verifyUsername);

//验证邮箱
router.post('/verifyEmail',userService.verifyEmail);

//用户修改密码
router.post('/updatePassword',userService.updatePassword);

module.exports = router;